<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
    <meta charset="utf-8">
    <title></title>
</head>
<body>
<div>
    <canvas id="canvas" width="1024" height="600">
        dangqianliulanqibuzhichi canvas.
    </canvas>
</div>
</body>
<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
<script>

    /*$(function(){
      var canvas= document.getElementById('canvas');
      var context =canvas.getContext("2d");
      context.beginPath();//开始绘制123465
      context.moveTo(50,0);
      context.lineTo(700,600);
      context.lineTo(50,600);
      context.lineTo(50,0);
      context.closePath();//j结束绘制

    context.lineWidth=5;//绘制线条宽度
      context.fillStyle ='red';
      context.fill();
      context.strokeStyle='#0f0';
      context.stroke();//笔画
      context.beginPath();//开始绘制
      context.moveTo(100,0);
      context.lineTo(750,600);
      context.closePath();//j结束绘制
      context.strokeStyle='#00f';
      context.stroke();//笔画
    })*/
    var appendDiv = function (callback) {
        for (var i = 0; i < 20; i++) {
            var div = document.createElement('div');
            div.innerHTML = i;
            document.body.appendChild(div);
            if (typeof callback == 'function') {

                callback(div);
                console.log(callback(div))
            }
        }

    }
    appendDiv(function (node) {
        node.style.display = 'block';
    });

</script>
</html>
